# -*- mode: snippet -*-
# name: <form><input ng-pattern><span>error message</span></form>
# key: aform
# contributor: Chen Bin <chenbin DOT sh AT gmail>
# --
<div ng-form="${1:frm}">
  <div class="form-group">
    <label class="control-label">${2:User name}</label>
    <input class="form-control" type="text" name="${3:userName}" ng-model="${4:userData}.${3:$(yas/substr yas-text "[^ ]*")}" placeholder="" ng-pattern="/^[a-zA-Z0-9]+$/">
    <small ng-show="!${1:$(yas/substr yas-text "[^ ]*")}.${3:$(yas/substr yas-text "[^ ]*")}.$valid" class="error">Enter valid ${3:$(my-yas-camelcase-to-downcase (yas/substr yas-text "[^ ]*"))}</small>
  </div>
</form>